<?php
/**
 * User: helu
 * Date: 17-2-14
 * Time: 上午10:47
 */
require_once "dbcon.php";
require_once "BTParamBean.php";
require_once "CommonBean.php";

$dbConn = getDB();

$rbean = new CommonBean();
$databean = new BTParamBean();

if ($dbConn == null) {
    $rbean->code = 500;
    $rbean->message = "数据库连接错误";
    echo json_encode($rbean);
    $dbConn->close();
    return;
}

$bta = $_POST["BTA"];
$btn = $_POST["BTN"];

if ($bta == null || $btn == null) {
    $rbean->code = 400;
    $rbean->message = "参数请求错误";
    echo json_encode($rbean);
    $dbConn->close();
    return;
}
$sql = "UPDATE `a1001221749`.`lubike` SET `bta`=?, `btn`=? WHERE `id`='1'";
$stmt = $dbConn->prepare($sql);
$stmt->bind_param("dd", $bta, $btn);//绑定时使用变量绑定
//执行预处理
$result = $stmt->execute();
if ($result) {
    $rbean->code = 200;
    $rbean->message = "成功";
} else {
    $rbean->code = 400;
    $rbean->message = "数据服务器执行错误";
}

echo json_encode($rbean);
$stmt->close();
$dbConn->close();